<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include.inc.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="student/list"
		method="post">
	<input type="hidden" name="pageNum" value="${page.pageNo }" />
	<input type="hidden" name="numPerPage" value="${page.pageSize }" />
	<input type="hidden" name="orderField" value="" />
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>姓名：</td>
					<td><input type="text" name="name" value="${page.condition.name }" /></td>
					<td>性别：</td>
					<td>
						<select name="sex" >
							<option value="">未选择</option>
							<option value="男" <c:if test="${page.condition.sex=='男' }">selected</c:if> >男</option>
							<option value="女" <c:if test="${page.condition.sex=='女' }">selected</c:if> >女</option>
						</select>
					</td>
					<td>地址：</td>
					<td><input type="text" name="address" value="${page.condition.address }" /></td>
					<td>年龄：</td>
					<td><input type="text" name="ageStart" value="${page.condition.ageStart }"/> - <input
						type="text" name="ageEnd" value="${page.condition.ageEnd}" />
					</td>
				</tr>
				<tr>
					<td>电话：</td>
					<td><input type="text" name="phone" value="${page.condition.phone }" /></td>
					<td>父母：</td>
					<td><input type="text" name="parentName" value="${page.condition.parentName }" /></td>
					<td>所在班级：</td>
					<td><select name="classId">
							<option value="">未选择</option>
							<c:forEach var="stuClass" items="${classList }">
							<option value="${stuClass.classId }" <c:if test="${stuClass.classId==page.condition.classId }">selected</c:if>>${stuClass.className }</option>
							</c:forEach>
					</select></td>
					<td>创建日期：</td>
					<td><input class="date" name="createDateStartStr" value="<fmt:formatDate value='${page.condition.createDateStart }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true" /> - <input
						class="date" name="createDateEndStr" dateFmt="yyyy-MM-dd HH:mm:ss" value="<fmt:formatDate value='${page.condition.createDateEnd }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						readonly="true" />
					</td>
				</tr>

			</table>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">检索</button>
							</div>
						</div>
					</li>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button onclick="formReSet(this)" type="button">重置</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="student/add" target="dialog" title="添加学生" rel="studentAddDialog" width="400" height="400"><span>添加</span></a></li>
			<li><a class="delete" href="student/deleteAll" target="selectedTodo"
				title="确定要删除选中的学生吗?"><span>删除</span></a></li>
			<li class="line">line</li>
			<li><a class="icon" href="student/export" target="studentExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="180">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl" title="全选"></th>
				<th width="40">序号</th>
				<th width="50">姓名</th>
				<th width="40">性别</th>
				<th width="40">年龄</th>
				<th width="100">地址</th>
				<th width="60">班级</th>
				<th width="80">电话</th>
				<th width="60">邮箱</th>
				<th width="80">创建日期</th>
				<th width="80">操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				int i = 0;
			%>
			<c:forEach var="student" items="${page.list}">
				<tr>
					<td>
						<input type="checkbox" id="ids" name="ids" value="${student.id }" />
					</td>
					<td><%=++i%></td>
					<td><c:out value="${student.name}"></c:out></td>
					<td><c:out value="${student.sex }"></c:out></td>
					<td><c:out value="${student.age }"></c:out></td>
					<td title="${student.address }"><c:out value="${student.address }"></c:out></td>
					<td title="${student.studentClass.className }"><c:out value="${student.studentClass.className }"></c:out></td>
					<td><c:out value="${student.studentInfo.phone }"></c:out></td>
					<td><c:out value="${student.studentInfo.email }"></c:out></td>
					<td><fmt:formatDate value='${student.createDate}' pattern='yyyy-MM-dd HH:mm:ss'/></td>
					<td>
						<a href="student/delete?studentId=${student.id}" target="ajaxTodo" title="确定要删除学生【${student.name }】吗？" class="btnDel">删除</a>
					 	<a href="student/modify?studentId=${student.id}" target="dialog" title="编辑学生" rel="editStu" class="btnEdit">编辑</a>
					 </td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="10" <c:if test="${page.pageSize==10 }">selected</c:if>>10</option>
				<option value="20" <c:if test="${page.pageSize==20 }">selected</c:if>>20</option>
				<option value="50" <c:if test="${page.pageSize==50 }">selected</c:if>>50</option>
				<option value="100" <c:if test="${page.pageSize==100 }">selected</c:if>>100</option>
				<option value="200" <c:if test="${page.pageSize==200 }">selected</c:if>>200</option>
			</select>
			<span>条，共${page.totalCount}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="${page.totalCount }" numPerPage="${page.pageSize}" pageNumShown="5" currentPage="${page.pageNo}"></div>

	</div>
</div>